package com.itheima.stream;

import java.util.ArrayList;
import java.util.List;

public class Demo04 {

    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of( "鹿晗", "吴签", "黄子韬","蔡徐坤"));
        ArrayList<String> newList = new ArrayList<>();
        list.stream().limit(2).forEach(s-> newList.add(s));
        System.out.println(newList);
        long count = list.stream().count();
        System.out.println(count);


    }

}
